package com.doit.day01

import scala.util.Sorting

object ScalaComTest {
  def main(args: Array[String]): Unit = {
    val list: Array[User] = List(
      new User(1, "zss", 18),
      new User(2, "lss", 58),
      new User(3, "aa", 28),
      new User(4, "bbs", 38),
      new User(5, "ccs", 68),
      new User(7, "dds", 98)
    ).toArray

    Sorting.quickSort(list)(new MyOrdering)

    list.toList.foreach(println)


  }
}

class MyOrdering extends Ordering[User]{
  override def compare(x: User, y: User): Int = x.id - y.id
}
